package com.xr.stk.dto;

import java.io.Serializable;
import java.text.DecimalFormat;

/**
 * Created by Arnold on 2018-10-18 10:04.
 */
public class GoldenSectionDto implements Serializable {

  private double baseValue;

  private String l_0191;
  private String l_0382;
  private String l_0618;
  private String l_0809;
  private String l_1382;
  private String l_1618;

  public static class Builder {
    private GoldenSectionDto gs;

    public Builder() {
      gs = new GoldenSectionDto();
    }

    public Builder setBaseValue(double baseValue) {
      gs.baseValue = baseValue;
      DecimalFormat df = new DecimalFormat("#.000");
      gs.l_0191 = df.format(baseValue + baseValue * 0.191);
      gs.l_0382 = df.format(baseValue + baseValue * 0.382);
      gs.l_0618 = df.format(baseValue + baseValue * 0.618);
      gs.l_0809 = df.format(baseValue + baseValue * 0.809);
      gs.l_1382 = df.format(baseValue + baseValue * 1.382);
      gs.l_1618 = df.format(baseValue + baseValue * 1.618);
      return this;
    }

    public GoldenSectionDto build() {
      return gs;
    }
  }

  public double getBaseValue() {
    return baseValue;
  }

  public String getL_0191() {
    return l_0191;
  }

  public String getL_0382() {
    return l_0382;
  }

  public String getL_0618() {
    return l_0618;
  }

  public String getL_0809() {
    return l_0809;
  }

  public String getL_1382() {
    return l_1382;
  }

  public String getL_1618() {
    return l_1618;
  }

  @Override
  public String toString() {
    final StringBuffer sb = new StringBuffer("GoldenSectionDto{");
    sb.append("baseValue=").append(baseValue);
    sb.append(", l_0191='").append(l_0191).append('\'');
    sb.append(", l_0382='").append(l_0382).append('\'');
    sb.append(", l_0618='").append(l_0618).append('\'');
    sb.append(", l_0809='").append(l_0809).append('\'');
    sb.append(", l_1382='").append(l_1382).append('\'');
    sb.append(", l_1618='").append(l_1618).append('\'');
    sb.append('}');
    return sb.toString();
  }
}
